<script setup>
import { RouterView } from 'vue-router'
</script>

<template>
  <div>
    <header>
      <nav>
        <div class="logo">
          <RouterLink to="/">
            <img src="/travel-images/1 (2).png" alt="马蜂窝" />
          </RouterLink>
        </div>
        <ul>
          <li><RouterLink to="/" active-class="active">首页</RouterLink></li>
          <li><RouterLink to="/destination" active-class="active">目的地</RouterLink></li>
          <li><RouterLink to="/travel-guide" active-class="active">旅游攻略</RouterLink></li>
          <li><RouterLink to="/travel" active-class="active">去旅行</RouterLink></li>
        </ul>
        <div class="login">
          <RouterLink to="/about">登录</RouterLink>&nbsp; | &nbsp;<RouterLink to="/about">注册</RouterLink>
        </div>
      </nav>
      <div id="banner">
        <img src="/travel-images/1-1.png" alt="旅游目的地" id="pic" />
        <div id="left">&gt;</div>
        <div id="right">&lt;</div>
      </div>
    </header>

    <main>
      <RouterView />
    </main>

    <footer>
      <p>© 2022 Mafengwo.cn 京ICP备11015476号<img src="/travel-images/1 (1).png" alt="备案" /> 京公网安备11010502013401号 京ICP证110318号</p>
    </footer>
  </div>
</template>

<style>
/* 基础样式重置 */
html, body, ul, h1, h2, h3, h4, h5, h6, p {
  padding: 0;
  margin: 0;
}

ul {
  list-style-type: none;
}

/* 导航栏样式 */
header {
  width: 100%;
}

nav {
  height: 70px;
  position: relative;
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  padding: 0 20px;
}

.logo {
  width: 142px;
  height: 39px;
  margin-right: 30px;
}

.logo img {
  height: 100%;
}

.login {
  width: 100px;
  height: 39px;
  color: #999;
}

.login a:link, .login a:visited {
  color: #ff9c00;
  font-size: 14px;
  text-decoration: none;
}

.login a:hover, .login a:active {
  text-decoration: underline;
}

nav ul {
  overflow: hidden;
  flex: 1;
  display: flex;
  justify-content: center;
}

nav ul li {
  float: left;
}

nav li a:link, nav li a:visited {
  display: block;
  height: 70px;
  line-height: 70px;
  padding-left: 20px;
  padding-right: 20px;
  font-size: 16px;
  color: #666;
  text-decoration: none;
  box-sizing: border-box;
}

nav li a:hover, nav li a:active {
  color: #ff9c00;
  border-bottom: 3px solid #ff9c00;
}

/* 当前页面链接样式 */
a.active:link, a.active:visited, a.active:hover, a.active:active {
  background-color: #ff9c00;
  color: #fff;
}

/* 轮播图样式 */
#banner {
  width: 1200px;
  height: 450px;
  position: relative;
  margin: 0 auto;
  overflow: hidden;
}

#pic {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#left, #right {
  width: 40px;
  height: 60px;
  background-color: rgba(0, 0, 0, 0.3);
  text-align: center;
  line-height: 60px;
  font-size: 24px;
  color: #fff;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
}

#left {
  left: 0;
}

#right {
  right: 0;
}

/* 主内容区域 */
main {
  width: 1100px;
  margin: 20px auto;
  overflow: hidden;
}

/* 页脚样式 */
footer {
  width: 100%;
  height: 90px;
  background-color: #3c3c3c;
  margin-top: 40px;
}

footer p {
  width: 540px;
  margin-left: auto;
  margin-right: auto;
  padding-top: 30px;
  font-size: 12px;
  color: rgb(219, 219, 219);
  border-bottom: 1px solid rgb(219, 219, 219);
  padding-bottom: 7px;
  padding-left: 10px;
}

/* 单行文本省略 */
.ellipsis {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* 响应式设计 */
@media (max-width: 1200px) {
  #banner {
    width: 100%;
  }
  
  .logo {
    left: 20px;
  }
  
  .login {
    right: 20px;
  }
}

@media (max-width: 768px) {
  nav {
    height: auto;
    padding: 10px 0;
  }
  
  nav ul {
    width: 100%;
    text-align: center;
  }
  
  nav ul li {
    float: none;
    display: inline-block;
  }
  
  .logo, .login {
    position: static;
    margin: 10px auto;
    text-align: center;
  }
  
  #banner {
    height: 200px;
  }
  
  main {
    width: 100%;
    padding: 0 20px;
  }
}
</style>
